// AWTChoice.h: interface for the AWTChoice class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AWTCHOICE_H__E73F9CF6_A616_11D2_A454_006097A44215__INCLUDED_)
#define AFX_AWTCHOICE_H__E73F9CF6_A616_11D2_A454_006097A44215__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "AWTComponent.h"

class AFX_EXT_CLASS AWTChoice : public AWTComponent,
										  			    public AWTItemSelectable
{
DECLARE_DYNAMIC(AWTChoice)
public:
	AWTChoice();
	virtual ~AWTChoice();

	int getItemCount() 
		{return countItems();}
	int countItems() 
		{return m_items.GetCount();}
	CString& getItem(int index);
  void add(LPTSTR item)
		{addItem(CString(item));}
  void add(CString& item) 
		{addItem(item);}
	void addItem(CString& item);
	void insert(CString& item, int index);
	void removeAll() 
		{clear();}
	void clear();
	void remove(CString& item);
	void remove(int position) 
		{delItem(position);}
	void delItem(int position) 
		{delItems(position, position);}
	CString& getSelectedItem();
	int getSelectedIndex() 
		{return m_selectedIndex;}
	void select(int index);
	void select(CString& item);

	virtual CStringArray* getSelectedObjects();
	virtual AWTObject* getObject()
		{return this;}
	virtual void addItemListener(AWTItemListener* l) 
		{m_itemListener = AWTEventMulticaster::add(m_itemListener, l);}
  virtual void removeItemListener(AWTItemListener* l) 
		{m_itemListener = AWTEventMulticaster::remove(m_itemListener, l);}
	virtual void processItemEvent(AWTItemEvent* e);
	virtual BOOL isFocusTraversable()
		{return TRUE;}

	virtual CWnd* createComponent();
	virtual CSize getMinimumSize();
	virtual CSize getPreferredSize();

private:
	void delItems(int start, int end);

	CStringList m_items;
  int m_selectedIndex;
	AWTItemListener* m_itemListener;
	CString m_nullString;
};

#endif // !defined(AFX_AWTCHOICE_H__E73F9CF6_A616_11D2_A454_006097A44215__INCLUDED_)
